<%var csstpl = {%>
    <link href="${basepath}/vendor/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <style>
        * {
            outline: none;
        }
        
        li {
            list-style: none;
        }
        
        .hide {
            display: none;
        }
        
        .clear {
            clear: both;
            margin: 0;
        }
        
        a {
            color: #337ab7;
            text-decoration: none;
        }
        
        .laydate-icon {
            border: 0px solid #ccc !important;
            background-image: none !important;
        }
        
        .search_panel {
            position: relative;
            margin-bottom: 20px;
            padding: 15px;
            background: #fff;
            border: 1px solid #e7eaec;
            border-radius: 3px;
        }
        
        .search_panel .part1 {
            width: 250px;
            border: 0px solid #f00;
        }
        
        .search_panel .part1 label {
            position: relative;
            display: block;
            margin: 20px 0;
            padding-right: 160px;
            text-align: right;
        }
        
        .search_panel .part1 input {
            position: absolute;
            right: 0;
            top: -5px;
            width: 150px;
            padding: 6px;
            font: 13px/15px "微软雅黑";
            border: 1px solid #ddd;
            border-radius: 3px;
        }
        
        .search_panel .part2 {
            position: absolute;
            left: 300px;
            top: 17px;
            border: 0px solid #f00;
        }
        
        .search_panel .part2 label {
            position: relative;
            display: block;
            margin: 10px 0;
            padding-right: 160px;
        }
        
        .search_panel .part2 input {
            width: 150px;
            padding: 6px;
            font: 13px/15px "微软雅黑";
            border: 1px solid #ddd;
            border-radius: 3px;
        }
        
        .search_panel .part2 select {
            width: 150px;
            padding: 5px;
            font: 12px/15px "微软雅黑";
            border: 1px solid #ddd;
            border-radius: 3px;
        }
        
        .search_panel .part3 {
            position: absolute;
            padding: 15px;
            border: 0px solid #f00;
        }
        
        .search_panel .part3 label {
            position: relative;
            display: block;
            margin: 10px 0;
            padding-right: 160px;
        }
        
        .search_panel .part3 input {
            width: 150px;
            padding: 6px;
            font: 13px/15px "微软雅黑";
            border: 1px solid #ddd;
            border-radius: 3px;
        }
        
        .search_panel .part3 select {
            width: 150px;
            padding: 5px;
            font: 12px/15px "微软雅黑";
            border: 1px solid #ddd;
            border-radius: 3px;
        }
        
        .search_panel .btns {
            padding: 10px 0 0 100px;
        }
        
        .search_panel .btns .btn.color {
            font: 13px/20px "微软雅黑";
            margin-right: 5px;
            padding: 3px 20px;
            background: #1AB394;
            color: #fff;
            border: 1px solid #1AB394;
        }
        
        .search_panel .btns .btn.line {
            font: 13px/20px "微软雅黑";
            margin-right: 5px;
            padding: 3px 20px;
            background: #ffffff;
            color: #333;
            border: 1px solid #ddd;
        }
        
        .list {
            position: relative;
            margin-top: 60px;
            background: #fff;
            border: 1px solid #e7eaec;
            border-radius: 3px;
        }
        
        .list .menu {
            position: absolute;
            left: 0;
            top: -42px;
            padding: 0;
        }
        
        .list .menu li {
            float: left;
            margin-left: -1px;
        }
        
        .list .menu li a {
            display: block;
            width: 80px;
            padding: 0;
            background: #F8F8F8;
            font: 13px/40px "微软雅黑";
            color: #333;
            text-align: center;
            border: 1px solid #e7eaec;
        }
        
        .list .menu li.active a {
            background: #fff;
            border-bottom: 1px solid #fff;
        }
        
        .list .contt {
            padding: 15px;
        }
        
        table {
            width: 100%;
        }
        
        table td2 {
            padding: 20px;
            background: #f8f8f8;
            border: 2px solid #fff;
            vertical-align: top;
        }
        /* table tbody { margin:10px 0; border:1px solid #F8F8F8; } */
        
        table tbody tr.title {
            border: 1px solid #e7eaec;
        }
        
        table tbody tr.title td {
            padding: 12px;
            background: #f8f8f8;
            vertical-align: top;
        }
        
        table tbody tr.sep {
            height: 10px;
        }
        
        table tbody tr.remark {
            border: 1px solid #e7eaec;
        }
        
        table tbody tr.remark td {
            padding: 10px;
            color: #f33;
        }
        
        table tbody tr.info {
            border: 1px solid #e7eaec;
            background: #F8F8F8;
        }
        
        table tbody tr.info td {
            padding: 10px;
        }
        
        table tbody tr.detail {
            padding-top: 10px;
        }
        
        table tbody tr.detail td {
            padding: 12px;
            vertical-align: top;
            border: 1px solid #e7eaec;
        }
        
        table tbody tr.detail td b {
            font-weight: normal;
            margin-right: 8px;
        }
        
        table tbody tr.detail td .btn {
            font: 13px/20px "微软雅黑";
            margin-right: 5px;
            padding: 3px 20px;
            background: #ffffff;
            color: #333;
            border: 1px solid #ddd;
        }
        
        table tbody tr.detail td.td1 img {
            float: left;
            width: 80px;
            margin-right: 12px;
        }
        
        table tbody tr.detail td.td1 .name {
            font: 14px/1.5em "微软雅黑";
            margin-bottom: 8px;
            display: block;
        }
        
        table tbody tr.detail td.td1 p {
            font: 14px/1.5em "微软雅黑";
            color: #999;
            margin: 0;
        }
        
        table tbody tr.detail td.td2 {
            width: 100px;
            text-align: center;
        }
        
        table tbody tr.detail td.td3 {
            width: 100px;
            text-align: center;
        }
        
        table tbody tr.detail td.td4 {
            width: 100px;
            text-align: center;
        }
        
        table tbody tr.detail td.td5 {
            width: 150px;
        }
        
        table tbody tr.detail td.td6 {
            width: 100px;
            text-align: center;
        }
        
        table tbody tr.detail td.td7 {
            width: 120px;
            text-align: center;
        }
        
        table tbody tr.detail td.td7 a {
            font: 14px/1.5em "微软雅黑";
            margin-bottom: 10px;
            display: block;
        }
        
        table tbody tr.detail td.td8 {
            width: 150px;
            text-align: center;
        }
        
        table tbody tr.detail td.td9 {
            width: 120px;
            text-align: center;
        }
        
        .send_contt {
            display: none;
        }
        
        .send_panel div.bind {
            position: relative;
            padding-left: 60px;
            margin-bottom: 10px;
        }
        
        .send_panel div.bind label {
            position: absolute;
            left: 0;
            font: 14px/35px "微软雅黑";
        }
        
        .send_panel div.bind input {
            display: block;
            width: 100%;
            padding: 5px;
            border: 1px solid #e5e5e5;
            border-radius: 3px;
            font: 14px/20px "微软雅黑";
        }
        
        .send_panel div.bind select {
            display: block;
            width: 100%;
            padding: 5px;
            border: 1px solid #e5e5e5;
            border-radius: 3px;
            font: 14px/20px "微软雅黑";
        }
        
        .new-info {
            color: #1ab394;
        }
        
        .empty {
            height: 400px;
            background: url(/static/vendor/img/order_empty.png) no-repeat center;
        }
    </style>

    <link rel="stylesheet" href="${basepath}/plugin/select2/css/select2.min.css" media="screen">
    <%};%>
        <%var jstpl = {%>
            <script src="${basepath}/vendor/script/Ajax.web.1.0.3.js"></script>
            <script src="${basepath}/vendor/script/order.js?v=a212"></script>
            <script src="${basepath}/plugin/select2/js/select2.min.js"></script>
            <script>
                var app = new Vue({
                    el: ".wrapper",
                    data: {
                        query: {
                            pageNumber: 1,
                            pageSize: 10,
                            state: "",
                            startTime: "",
                            endTime: "",
                            orderPlatform: "",
                            expressReceiveName: "",
                            productId: "",
                            id: "",
                            expressPhone: "",
                            itemId: ""
                        },
                        data_result: {},
                        express_detail: []
                    },
                    created: function() {
                        this.loadPage("init");
                    },
                    methods: {
                        loadPage: function(model) { //载入模式有两种  init初始化载入 load分页载入
                            this.query.startTime = $("#start").val();
                            this.query.endTime = $("#end").val();

                            if (model == "init") {
                                this.query.pageNumber = 1;
                            }
                            Ajax("/system/order/orderListQuery", this.query, function(d) {
                                app.data_result = d;
                                if (d.firstPage == true) {
                                    laypage({
                                        cont: 'page1',
                                        skin: 'molv',
                                        skip: true, //是否开启跳页
                                        curr: 6, //初始化当前页
                                        pages: d.totalPage, //可以叫服务端把总页数放在某一个隐藏域，再获取。假设我们获取到的是18
                                        curr: function() { //通过url获取当前页，也可以同上（pages）方式获取
                                            return d.pageNumber;
                                        }(),
                                        jump: function(obj, first) { //触发分页后的回调
                                            app.query.pageNumber = obj.curr;
                                            if (app.query.pageSize != obj.limit) {
                                                app.query.pageSize = obj.limit;
                                                app.loadPage("init");
                                                return;
                                            }
                                            if (!first) {
                                                app.loadPage("load");
                                            }
                                        }
                                    });
                                }
                            })
                        },
                        reSetPushOrder: function(id) {
                            gx.confirm("你是否确定重置订单？", function() {
                                gx.ajax("/system/order/push/reSetOrderPush?order_id=" + id, function(d) {
                                    if (d.state) {
                                        app.loadPage("load");
                                    }
                                })
                            })
                        },
                        btnRemark: function(order) {
                            layer.prompt({
                                title: "修改备注",
                                value: order.admin_remark,
                                formType: 2
                            }, function(value, index) {
                                url = "/system/order/changeRemark",
                                    data = {
                                        "order_id": order.id,
                                        "admin_remark": value
                                    };
                                Ajax(url, data, function(ret) {
                                    if (ret.state) {
                                        order.admin_remark = value;
                                        layer.close(index);
                                    } else {
                                        layer.msg(ret.msg);
                                    }
                                });
                            });
                        },
                        skuText: function(item) {
                            app.query.itemId = item.item_id;
                            gx.ajax("/system/order/edit/sku_list/" + item.product_id, function(d) {
                                $("#sku_data_list").empty();
                                for (var i = 0; i < d.data.length; i++) {
                                    if (d.data[i].sku_id == item.sku_id) {
                                        $("#sku_data_list").append("<option selected value='" + d.data[i].sku_id + "'>" + d.data[i].sku_text + "</option>");
                                    } else {
                                        $("#sku_data_list").append("<option value='" + d.data[i].sku_id + "'>" + d.data[i].sku_text + "</option>");
                                    }
                                }
                                $('#myModal_c').modal('show')
                            })
                        },
                        expressAmount: function(order) {
                            layer.prompt({
                                title: "修改运费",
                                value: order.express_amount
                            }, function(value, idx, layelm) {
                                value = layelm.val();
                                switch (true) {
                                    case !/^(\+|\-)?(\d+|\d+\.\d+)$/.test(value):
                                        layelm.css({
                                            borderColor: "#f66"
                                        });
                                        setTimeout(function() {
                                            layelm.css({
                                                borderColor: "#ccc"
                                            });
                                        }, 1000);
                                        return;
                                    default: //修改物流的
                                        if (value < 0) {
                                            return;
                                        }
                                }
                                //alert(oid);
                                url = "/system/order/changeOrderPostFee",
                                    data = {
                                        "order_id": order.id,
                                        "post_fee": value
                                    };
                                Ajax(url, data, function(ret) {
                                    //console.info(ret);
                                    if (ret.state) {
                                        order.express_amount = ret.data.express_amount;
                                        order.total_amount = ret.data.total_amount;
                                        layer.close(idx);
                                    } else
                                        layer.msg(ret.msg);
                                });
                            });
                        },
                        totalAmount: function(order) {
                            layer.prompt({
                                title: "修改订单总额",
                                value: order.total_amount
                            }, function(value, idx, layelm) {
                                value = layelm.val();
                                switch (true) {
                                    case !/^(\+|\-)?(\d+|\d+\.\d+)$/.test(value):
                                        layelm.css({
                                            borderColor: "#f66"
                                        });
                                        setTimeout(function() {
                                            layelm.css({
                                                borderColor: "#ccc"
                                            });
                                        }, 1000);
                                        return;
                                    default: //修改物流的
                                        if (value < 0) {
                                            return;
                                        }
                                }
                                //alert(oid);
                                url = "/system/order/changeOrderMoney",
                                    data = {
                                        "order_id": order.id,
                                        "total_fee": value
                                    };
                                Ajax(url, data, function(ret) {
                                    //console.info(ret);
                                    if (ret.state) {
                                        order.total_amount = ret.data.total_amount.toFixed(2);
                                        layer.close(idx);
                                    } else
                                        layer.msg(ret.msg);
                                });
                            });
                        },
                        changeAddr: function(order) {
                            layer.prompt({
                                title: "修改地址",
                                value: order.express_address,
                                formType: 2
                            }, function(value, index) {
                                url = "/system/order/changeAddress",
                                    data = {
                                        "order_id": order.id,
                                        "express_address": value
                                    };
                                Ajax(url, data, function(ret) {
                                    if (ret.state) {
                                        order.express_address = value;
                                        layer.close(index);
                                    } else {
                                        layer.msg(ret.msg);
                                    }
                                });

                            });
                        },
                        postOrder: function(order, event) {
                            var obj = event.currentTarget;
                            gx.ajax("/system/order/push_order/" + order.id, function(d) {
                                if (d.state) {
                                    $(obj).hide();
                                    $(".inteeface_state").text("已经推送");
                                    gx.toast("下单成功，请注意去支付！");
                                } else {
                                    gx.alert(d.msg)
                                }
                            })
                        },
                        excel: function() {
                            //alert(JSON.stringify(this.query));
                            window.location.href = "/system/excel/order?obj=" + JSON.stringify(this.query);
                        },
                        btnSend: function(id) {
                            layer.open({
                                title: "发货信息",
                                skin: "send_panel",
                                content: $(".send_contt").html(),
                                yes: function(idx, layelm) {
                                    elm = layelm.find("select");
                                    val = elm.val();
                                    if (val == "") {
                                        elm.css({
                                            borderColor: "#f66"
                                        });
                                        setTimeout(function() {
                                            elm.focus().css({
                                                borderColor: "#ccc"
                                            });
                                        }, 1000);
                                        return;
                                    } else if (val != "ziti") {
                                        elm = layelm.find("input");
                                        val = elm.val();
                                        if (val == "") {
                                            elm.css({
                                                borderColor: "#f66"
                                            });
                                            setTimeout(function() {
                                                elm.focus().css({
                                                    borderColor: "#ccc"
                                                });
                                            }, 1000);
                                            return;
                                        }
                                    }
                                    express_no = layelm.find("input").val();
                                    express_name = layelm.find("select").val();
                                    url = "/system/order/addExpress";
                                    data = {
                                        "order_id": id,
                                        "express_name": express_name,
                                        "express_no": express_no
                                    };
                                    Ajax(url, data, function(ret) {
                                        if (ret.state) {
                                            //去掉按钮
                                            $("#btn" + id).hide();
                                            $("." + id).text("发货成功");
                                            layer.closeAll();
                                        } else {
                                            layer.msg(ret.msg);
                                        }
                                    });
                                }
                            });
                        },
                        btnRefund: function(id, event) {
                            var btn = event.currentTarget;
                            gx.confirm("您是否确定退款？", function() {
                                url = "/system/order/qiangzhi_refund/" + id;
                                //data = {"order_id":oid,"express_name":express_name,"express_no":express_no};
                                Ajax(url, function(ret) {
                                    if (ret.state) {
                                        //去掉按钮
                                        //$("#btn"+oid).hide();
                                        btn.hide();
                                        $(".refund" + id).text("已经退款处理");
                                        layer.closeAll();
                                    } else {
                                        layer.msg("退款失败，应该是达到退款最大金额或大于实际付款金额了。");
                                    }
                                });
                            })
                        },
                        btnZdRefund: function(id, event) {
                            var btn = event.currentTarget;
                            layer.prompt({
                                title: '输入退款金额',
                                formType: 0
                            }, function(price, index) {
                                var url = "/system/order/zhiding_refund/" + id + "?price=" + price;
                                Ajax(url, function(ret) {
                                    if (ret.state) {
                                        layer.msg("退款成功");
                                        location.href = location.href;
                                    } else {
                                        layer.msg("退款失败，应该是达到退款最大金额或大于实际付款金额了。");
                                    }
                                });
                            });
                        },
                        expressView: function(order) {
                            gx.ajax("/system/order/order_express?order_id=" + order.id, function(ret) {
                                    if (ret.state) {
                                        app.express_detail = JSON.parse(ret.data.content);
                                        $('#myModal_a').modal('show');
                                    } else {
                                        layer.msg(ret.msg);
                                    }
                                })
                                /* var express_name=order.express_name;
			var express_code  ="";
			if(express_name.indexOf("申通")!=-1){
				express_code  =  "shentong";
			}else if(express_name.indexOf("韵达")!=-1){
				express_code  =  "yunda";
			}
        	var express_no=order.express_no;
        	gx.iframeindex=layer.open({
    		    type: 2,
    		    title: "快递查看",
    		    shadeClose: true,
    	        shade: false,
    	        maxmin: false, 
    		    shade: 0.8,
    		    area: ['375px ','627px'],
    		   // content: "http://m.kuaidi100.com/index_all.html?postid="+express_no+"&callbackurl=http://mall.ab-union.cn/wx/about"
    		    content: "http://m.kuaidi100.com/index_all.html?type="+express_code+"&postid="+express_no+"&callbackurl=http://mall.ab-union.cn/wx/about"
    		}); */
                        },
                        activeRefundDetails: function(refundFee, isAddFreight, date) {
                            if (isAddFreight == 0) {
                                layer.msg('商家于' + date + '主动退款' + (refundFee / 100) + '元');
                            } else {
                                layer.msg('商家于' + date + '主动退款' + (refundFee / 100) + '元(含运费)');
                            }
                        }
                    }
                })

                $(".js-example-basic-single").select2();

                $("ul.menu li").on("click", function() {
                    $("ul.menu li").removeClass("active");
                    $(this).addClass("active");
                    $("#type_id").val($(this).data("state"));
                    app.query.state = $(this).data("state");
                    app.loadPage("init");
                })

                $("#type_id").on("change", function() {
                    app.query.state = $(this).val();
                    $("ul.menu li").removeClass("active");
                    $("ul.menu li[data-state='" + $(this).val() + "']").addClass("active");
                    app.loadPage("init");
                })

                $("#productId").on("change", function() {
                    app.query.productId = $(this).val();
                    app.loadPage("init");
                })

                $("#orderPlatform").on("change", function() {
                    app.query.orderPlatform = $(this).val();
                    app.loadPage("init");
                })

                function selExpress(_this) {
                    if ($(_this).val() == "ziti") {
                        $(_this).parent().next().find("input").val("");
                        $(_this).parent().next().hide();
                    }
                }
            </script>
            <%};%>
                <%layout("../layout/_layout_mall.html",{title:'小金娱',jstpl:jstpl,csstpl:csstpl}){ %>

                    <div class="wrapper wrapper-content" v-cloak>
                        <!-- 搜索面板 -->
                        <div class="search_panel">
                            <div class="part1">
                                <label>订单号：<input type="text" v-model="query.id"/></label>
                                <label>收货人姓名：<input type="text"  v-model="query.expressReceiveName"  /></label>
                                <label>收货人手机：<input type="text" v-model="query.expressPhone"  /></label>
                            </div>
                            <div class="part2">
                                <label>商品查询： <#select 
							 text="product_name"
							 key="id"  
							 listdata="${product_list}" 
							 headkey="" 
							 headtext="全部商品" 
							attr=" id='productId' data-rule style='min-width:80%' v-model='query.productId'  class='span3 input js-example-basic-single' "
							/></label>
                                <label>订单状态： 
    		    <#select attr=' id="type_id" v-model="query.state" ' listdata="${state_list}" text="state_name" key="state_id" />
    		  </label>
                                <label>下单时间： <input type="text" id="start" class="date1" readonly /> 至 <input id="end" type="text" class="date2" readonly /></label>
                                <label>订单来源： 
	    		 <#select attr="data-rule id='orderPlatform' v-model='query.orderPlatform'  class='span12'" listdata="${@AppConst.Order_Platform}" headkey="" headtext="请选择订单来源"/>
	    		  </label>
                            </div>
                            <div>

                            </div>
                            <div class="btns" style="margin-top: 50px; padding: 0px; text-align: right;">
                                <a href="javascript:;" class="btn color" @click="loadPage('init')">筛选</a>
                                <a href="javascript:;" class="btn line" @click="excel()">订单导出</a>
                                <a href="javascript:;" style="display: none;" class="excel_detail" class="btn btn-success">订单详细导出(附有商品)</a>
                            </div>
                            <!--  </form>  -->
                        </div>

                        <!-- 订单列表 -->
                        <div class="list">
                            <ul class="menu">
                                <li data-state="" class="active"><a href="#">全部</a></li>
                                <%for(s in state_list!){%>
                                    <li data-state="${s.state_id!}"><a href="#" style="width:${(strutil.length(s.state_name!)*20)+'px'};">${s.state_name!}</a></li>
                                    <%}%>
                            </ul>
                            <div class="contt">
                                <!-- <div class="empty"></div> -->
                                <table>
                                    <tr class="title">
                                        <td>商品</td>
                                        <td>单价/数量</td>
                                        <td>售后</td>
                                        <td>运费</td>
                                        <td>订单金额</td>
                                        <!-- <td>涨价或减价</td> -->
                                        <td>配送地址</td>
                                        <td>下单时间</td>
                                        <td>收件人</td>
                                        <td>订单状态</td>
                                    </tr>
                                    <!-- fang  2016-06-22 -->
                                    <tbody :data-id="d.id" v-for="d in data_result.list">
                                        <tr class="sep">
                                            <td colspan="8"></td>
                                        </tr>
                                        <tr class="info">
                                            <td colspan="7"><code>{{d.type==1?'普通商品':d.type==6?'货款订单':'预售商品'}}</code> 订单号：{{d.id}}
                                                <!-- <span v-if="d.interface_state!=0 && d.state==1" class="label label-warning inteeface_state" @dblclick="reSetPushOrder(d.id)">
	    	        {{d.interface_state_name}}</span><span v-if="d.interface_state!=0 && d.state==1"> - {{d.interface_phone}} - {{d.interface_oder_id}}-{{d.interface_error_msg}}</span>
	    	   		<button v-if="(d.interface_state!=0 && d.state==1)&&(d.interface_state==1 || d.interface_state==97)" type="button"  @click="postOrder(d,$event)" class="btn btn-primary btn-xs">推送订单</button>
					 -->
                                                <code v-if="d.refund_remark!=null">{{d.refund_remark}}</code>
                                            </td>
                                            <td colspan="2" align="right"><a :href="'/system/order/detail/'+d.id">订单详情</a>
                                                <!-- - <a :href="'/system/order/commissionDetails/'+d.id">佣金详情</a>-->- <a href="javascript:;" @click="btnRemark(d)">备注</a>
                                            </td>
                                        </tr>
                                        <tr class="detail" v-for="(i,index) in d.item" v-if="index==0">
                                            <td class="td1" :data-id="i.item_id">
                                                <img :src="i.image_center" />
                                                <a href="javascript:;" class="name">{{i.product_name}}</a>
                                                <p><b :class="'skuText'+i.item_id">{{i.sku_text}}</b>
                                                    <a v-if="i.sku_text!=null && i.sku_text!=''" href="javascript:;" @click="skuText(i)">修改</a>
                                                </p>
                                            </td>
                                            <td class="td2">
                                                <p v-if="i.sku_price!=null && i.sku_price!=''">{{i.sku_price}}</p>
                                                <p v-else>{{i.product_price}}</p>
                                                <p>{{i.nums}} 件</p>
                                            </td>
                                            <td class="td8" v-if="i.refund!=null">
                                                <a v-if="i.refund_state!=1&&i.refund.is_active_refund!=1" :href="'/system/order/refund_detail/'+i.item_id" class="">{{i.refund_state_name}}</a>
                                                <a v-else @click="activeRefundDetails(i.refund.refund_fee,i.refund.is_add_freight,i.refund.createtime)" class="">{{i.refund_state_name}}</a>
                                            </td>
                                            <td class="td8" v-else>
                                                <a v-if="i.refund_state!=1" :href="'/system/order/refund_detail/'+i.item_id" class="">{{i.refund_state_name}}</a>
                                            </td>
                                            <td class="td3" :rowspan="d.item.length">
                                                <p>{{d.express_amount}}</p>
                                                <a v-if="d.state==0" href="javascript:;" @click="expressAmount(d)">修改</a>
                                            </td>
                                            <td class="td4" :rowspan="d.item.length">
                                                <p>{{d.total_amount}}</p>
                                                <a v-if="d.state==0" href="javascript:;" @click="totalAmount(d)">修改</a>
                                            </td>
                                            <td class="td5" :rowspan="d.item.length">
                                                <p><b>{{d.express_address}}</b><a href="javascript:;" @click="changeAddr(d)">修改</a></p>
                                            </td>
                                            <td class="td6" :rowspan="d.item.length">{{d.createtime}}</td>
                                            <td class="td7" :rowspan="d.item.length">
                                                <p>{{d.express_receive_name}}</p>
                                                <p>{{d.express_phone}}</p>
                                            </td>
                                            <td class="td9" :rowspan="d.item.length">
                                                <p v-if="d.state==0">{{d.state_name}}</p>
                                                <p v-if="d.state==1" :class="d.id">
                                                    <span v-if="d.type==1">
									{{d.state_name}}
								</span>
                                                    <span v-else>
									<label v-show="d.is_presale_state==1">待支付定金</label>
									<label v-show="d.is_presale_state==2">待支付尾款</label>
									<label v-show="d.is_presale_state==3">{{d.state_name}}</label>
								</span>
                                                </p>
                                                <a v-if="d.state==1 && d.is_presale_state==3 " href="javascript:;" :id="'btn'+d.id" class="btn btn_send " @click="btnSend(d.id)">发货</a><br/>
                                                <!-- <a v-if="d.state==1" href="javascript:;" :data-id="d.id" class="btn btn-info" @click="btnRefund(d.id,$event)">强制退全款</a>
			    	        <a v-if="d.state==1" href="javascript:;" :data-id="d.id" class="btn btn-info" @click="btnZdRefund(d.id,$event)">指定金额退款</a> -->
                                                <p v-if="d.state==2">{{d.state_name}}<span v-if="d.express_name=='ziti'">(自提)</span></p>
                                                <a v-if="d.state==2&&d.express_name!='ziti'" href="javascript:;" class="btn btn-primary btn-send express_search express_view" :data-id="d.id" :data-express-time="d.express_time" :data-express-name="d.express_name" :data-express-no="d.express_no" @click="expressView(d)">查看物流</a>
                                                <p v-if="d.state==6" :class="'refund'+d.id">{{d.state_name}}</p>
                                                <p v-if="d.state==7">{{d.state_name}}</p>
                                                <p v-if="d.state!=0 &&d.state!=1 && d.state!=2 && d.state!=6 && d.state!=7">{{d.state_name}}</p>
                                            </td>
                                        </tr>
                                        <tr v-else class="detail">
                                            <td class="td1" :data-id="i.item_id">
                                                <img :src="i.image_center" />
                                                <a href="javascript:;" class="name">{{i.product_name}}</a>
                                                <p><b>{{i.sku_text}}</b>
                                                    <a v-if="i.sku_text!=null && i.sku_text!=''" href="javascript:;" @click="skuText(i)">修改</a>
                                                </p>
                                            </td>
                                            <td class="td2">
                                                <p v-if="i.sku_price!=null && i.sku_price!=''">{{i.sku_price}}</p>
                                                <p v-else>{{i.product_price}}</p>
                                                <p>{{i.nums}} 件</p>
                                            </td>
                                            <td class="td8" v-if="i.refund!=null">
                                                <a v-if="i.refund_state!=1&&i.refund.is_active_refund!=1" :href="'/system/order/refund_detail/'+i.item_id" class="">{{i.refund_state_name}}</a>
                                                <a v-else @click="activeRefundDetails(i.refund.refund_fee,i.refund.is_add_freight,i.refund.createtime)" class="">{{i.refund_state_name}}</a>
                                            </td>
                                            <td class="td8" v-else>
                                                <a v-if="i.refund_state!=1" :href="'/system/order/refund_detail/'+i.item_id" class="">{{i.refund_state_name}}</a>
                                            </td>
                                        </tr>
                                        <tr v-if="d.user_remarks!=null && d.user_remarks!=''" class="remark">
                                            <td colspan="9">{{d.user_remarks}}</td>
                                        </tr>
                                    </tbody>
                                </table>

                                <div class="send_contt">
                                    <div class="bind">
                                        <label>选快递</label>
                                        <select onchange="selExpress(this)">
	    	  <option value="">请选择</option>
	    	  <%  for(express in @AppConst.Express){  %>
	    	  <option value="${express.key!}">${express.value!}</option>
	    	  <%  }  %>
	    	  </select>
                                    </div>
                                    <div class="bind">
                                        <label>订单号</label>
                                        <input type="text" placeholder="请输入" />
                                    </div>

                                </div>

                            </div>
                            <div v-if="data_result.list==0" class="empty"></div>
                        </div>
                        <br/>
                        <div class="dt_footer">
                            <div class="row-fluid">
                                <div class="span4">
                                    <div class="dataTables_info" id="demo-dtable-03_info">当前 {{data_result.pageNumber}} 共 {{data_result.totalPage}}页 {{data_result.totalRow}} 条信息</div>
                                </div>
                                <div class="span8">
                                    <div id="page1" class="dataTables_paginate paging_bootstrap pagination">
                                    </div>
                                </div>
                            </div>
                        </div>


                        <!-- 物流查询 -->
                        <!-- Modal_a -->
                        <div class="modal fade" id="myModal_c" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                            <div class="modal-dialog modal-md" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                        <h4 class="modal-title" id="myModalLabel">修改商品的SKU</h4>
                                    </div>
                                    <div class="modal-body row">
                                        <div class="col-md-12 col-xs-12">
                                            <div class="col-md-2 col-xs-5">
                                                <p class="row">sku：</p>
                                            </div>
                                            <div class="col-md-10 col-xs-7">
                                                <p class="row express_name">
                                                    <select id="sku_data_list" class="form-control m-b">
                          
                          </select>
                                                </p>
                                            </div>
                                        </div>

                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-success btn-save">修改</button>
                                        <button type="button" class="btn btn-default btn-close" data-dismiss="modal">关闭</button>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <!-- 物流查询 -->
                        <!-- Modal_a -->
                        <div class="modal fade" id="myModal_a" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                            <div class="modal-dialog modal-md" role="document" style="min-width:800px">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                        <h4 class="modal-title" id="myModalLabel">物流详情</h4>
                                    </div>
                                    <div class="modal-body row">
                                        <table class="table">
                                            <thead>
                                                <tr>
                                                    <th width="150px">时间</th>
                                                    <th>内容</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr v-for="detail in express_detail">
                                                    <td>{{detail.time}}</td>
                                                    <td>{{detail.context}}</td>
                                                </tr>
                                                <tr v-show="express_detail.length==0">
                                                    <td colspan="2" style="text-align:center">
                                                        <h2>暂无数据</h2>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default btn-close" data-dismiss="modal">关闭</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>


                    <%}%>

                        <script>
                            var item_id = null;
                            var item_obj = null;
                            $(function() {

                                $(".btn-save").click(function() {
                                        var url = "/system/order/edit/edit_sku?item_id=" + app.query.itemId + "&sku_id=" + $("#sku_data_list").val();
                                        gx.ajax(url, function(d) {
                                            if (d.state) {
                                                $('#myModal_c').modal('hide');
                                                $(".skuText" + app.query.itemId + "").text(d.msg);
                                                gx.toast("修改属性sku 成功！");
                                            } else {
                                                gx.alert(d.msg);
                                            }
                                        })
                                    })
                                    // 修改规格
                                $(".btn_sku").on("click", function() {
                                    item_obj = $(this).siblings("b");
                                    item_id = $(this).data("orderid");
                                    var sku_id = $(this).data("skuid");
                                    var productid = $(this).data("productid");
                                    gx.ajax("/system/order/edit/sku_list/" + productid, function(d) {
                                        $("#sku_data_list").empty();
                                        for (var i = 0; i < d.data.length; i++) {
                                            if (d.data[i].sku_id == sku_id) {
                                                $("#sku_data_list").append("<option selected value='" + d.data[i].sku_id + "'>" + d.data[i].sku_text + "</option>");
                                            } else {
                                                $("#sku_data_list").append("<option value='" + d.data[i].sku_id + "'>" + d.data[i].sku_text + "</option>");
                                            }
                                        }
                                        $('#myModal_c').modal('show')

                                    })
                                });
                                var laydate = layui.laydate;
                                //日期时间选择器
                                laydate.render({
                                    elem: '#start',
                                    type: 'datetime'
                                });
                                laydate.render({
                                    elem: '#end',
                                    type: 'datetime'
                                });
                                /*var start={elem:"#start",
                                		format:"YYYY-MM-DD hh:mm:ss",
                                		max:"2099-06-16 23:59:59",
                                		istime:true,istoday:false,
                                		choose:function(datas)
                                		{end.min=datas;end.start=datas}};

                                var end={elem:"#end",format:"YYYY-MM-DD hh:mm:ss",
                                		//min:laydate.now(),
                                		max:"2099-06-16 23:59:59",
                                		istime:true,istoday:false,
                                		choose:function(datas)
                                		{start.max=datas}
                                	};
                                laydate(start);
                                laydate(end);*/
                            })

                            /* $(".express_view").click(function(){
			var express_name=$(this).attr("data-express-name");
			var express_code  ="";
			if(express_name.indexOf("申通")!=-1){
				express_code  =  "shentong";
			}else if(express_name.indexOf("韵达")!=-1){
				express_code  =  "yunda";
			}
        	var express_no=$(this).attr("data-express-no");
        	gx.iframeindex=layer.open({
    		    type: 2,
    		    title: "快递查看",
    		    shadeClose: true,
    	        shade: false,
    	        maxmin: false, 
    		    shade: 0.8,
    		    area: ['375px ','627px'],
    		   // content: "http://m.kuaidi100.com/index_all.html?postid="+express_no+"&callbackurl=http://mall.ab-union.cn/wx/about"
    		    content: "http://m.kuaidi100.com/index_all.html?type="+express_code+"&postid="+express_no+"&callbackurl=http://mall.ab-union.cn/wx/about"
    		}); 
		}) */
                            //物流   方    2016-06-28
                            /* $(".express_search1").click(function(){
                            	//取得订单号  
                            	var order_id=$(this).attr("data-id");
                            	var express_name=$(this).attr("data-express-name");
                            	var express_no=$(this).attr("data-express-no");
                            	var express_time=$(this).attr("data-express-time");
                            	$(".express_name").text(express_name);
                            	$(".express_no").text(express_no);
                            	$(".express_time").text(express_time);
                            	$(".notice_express").text(express_time);
                            	$.ajax({
                            		cache : true,
                            		type : "post",
                            		url : "/api/express",
                            		data:{"order_id":order_id},
                            		//data:$('#static_table').serialize(),
                            		//data:{"service":service,"team_category":team_category,"people_num":people_num,"district_id":district_id},// 你的formid
                            		async : false,
                            		error : function(request) {
                            			alert("Connection error");
                            		},
                            		success : function(d) {
                            			console.info(d);
                            			console.info(JSON.parse(d.content));
                            			//layer.msg("请求成功成功!");
                            			var gettpl = $("#detail").html();
                            			laytpl(gettpl).render(JSON.parse(d.content), function(html) {
                            				$('#tbody_body').html(html);
                            			}); 
                            			//弹框
                            			$('#myModal_a').modal('show');
                            		}
                            	});
                            }) */

                            //订单详细导出  fang    2016-08-26
                            $(".excel_detail").click(function() {
                                var data = $("form").serialize();
                                //alert(data);
                                window.location.href = "/system/excel/order/detail?" + data;
                            })
                        </script>


                        <script id="detail" type="text/html">
                            {{# for(var i = 0, len = d.length; i
                            < len; i++){ }} {{# if(i==d.length-1){ }} <li class="col-md-12 col-xs-12 new-info">
                                <div class="col-md-3 col-xs-5">
                                    <p class="row">{{d[i].time}}</p>
                                </div>
                                <div class="col-md-9 col-xs-7">
                                    <p class="row">{{d[i].content}}</p>
                                </div>
                                </li>

                                {{# }else{ }}
                                <li class="col-md-12 col-xs-12 ">
                                    <div class="col-md-3 col-xs-5">
                                        <p class="row">{{d[i].time}}</p>
                                    </div>
                                    <div class="col-md-9 col-xs-7">
                                        <p class="row">{{d[i].content}}</p>
                                    </div>
                                </li>
                                {{# } }} {{# } }}

                        </script>